<?php
namespace app\member\controller;
use think\Controller;
use app\member\model\Member as MemberModel;
use think\Db;
class Passwd extends Common
{
    public function index()
    {
    	
        return view();
    }


    public function update(){
    	if(request()->isPost()){
            $oldpassword=input("oldpassword");
            $password=input("password");
            $passwordconfirm=input("passwordconfirm");
             $userid=session('id'); 
             $member=db('member')->where(array('id'=>$userid))->find();
             if($member['password']==$oldpassword){
             	$member=new MemberModel();
	        	$data=array("password"=>$password);
	        	//print_r($data);
	        	$member->update($data,array('id'=>$userid));
	        	$this->success('个人密码更新成功！',url('member/login/index'));
	        }else{
	        	$this->success("原始密码不对！",url('member/passwd/index'));
	        }
        	
        }
    }

   
}
